home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 26 / Cream of the Crop 26.iso / os2 / octa209s.zip / octave-2.09 / scripts / plot / mplot.m < prev    next >
Text File  |  1996-11-15  |  3KB  |  88 lines

  1. ## Copyright (C) 1996 John W. Eaton
  2. ##
  3. ## This file is part of Octave.
  4. ##
  5. ## Octave is free software; you can redistribute it and/or modify it
  6. ## under the terms of the GNU General Public License as published by
  7. ## the Free Software Foundation; either version 2, or (at your option)
  8. ## any later version.
  9. ##
  10. ## Octave is distributed in the hope that it will be useful, but
  11. ## WITHOUT ANY WARRANTY; without even the implied warranty of
  12. ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  13. ## General Public License for more details.
  14. ##
  15. ## You should have received a copy of the GNU General Public License
  16. ## along with Octave; see the file COPYING.  If not, write to the Free
  17. ## Software Foundation, 59 Temple Place - Suite 330, Boston, MA
  18. ## 02111-1307, USA.
  19.  
  20. ## usage: mplot (x, y)
  21. ##        mplot (x1, y1, x2, y2, ...)
  22. ##        mplot (x, y, fmt)
  23. ##
  24. ## This is a modified version of plot() command to work with
  25. ## multiplot version of gnuplot to plot multiple plots per page.
  26. ## This plot version automatically updates the plot position to
  27. ## next plot position after making the plot in the given subplot
  28. ## position.
  29. ##
  30. ## See command plot() for the various options to this command
  31. ## as this is just mulitplot version of the same command.
  32.  
  33. ## Author: Vinayak Dutt <Dutt.Vinayak@mayo.EDU>
  34. ## Adapted-By: jwe
  35.  
  36. function mplot (...)
  37.  
  38.   if (! gnuplot_has_multiplot)
  39.     error ("mplot: gnuplot does not appear to support this feature");
  40.   endif
  41.  
  42.   ## global variables to keep track of multiplot options
  43.  
  44.   global multiplot_mode
  45.   global multiplot_xsize multiplot_ysize
  46.   global multiplot_xn multiplot_yn
  47.   global multiplot_xi multiplot_yi
  48.  
  49.   ## This is a real kludge.  We gnuplot should be made so that replot can
  50.   ## be executed while doing multiple plots...
  51.  
  52.   global multiplot_save_auto_replot = automatic_replot
  53.  
  54.   if (automatic_replot)
  55.     warning ("turning off automatic replot for multiplot mode");
  56.     multiplot_save_auto_replot = automatic_replot;
  57.     automatic_replot = 0;
  58.   endif
  59.  
  60.   gset nologscale;
  61.   gset nopolar;
  62.  
  63.   __plt__ ("plot", all_va_args);
  64.  
  65.   ## update the plot position
  66.  
  67.   if (multiplot_mode)
  68.  
  69.     if (multiplot_xi < multiplot_xn)
  70.       multiplot_xi++;
  71.     else
  72.       multiplot_xi = 1;
  73.       if (multiplot_yi < multiplot_xn)
  74.     multiplot_yi++;
  75.       else
  76.     multiplot_yi = 1;
  77.       endif
  78.     endif
  79.  
  80.     xo = (multiplot_xi - 1.0)*multiplot_xsize;
  81.     yo = (multiplot_yn - multiplot_yi)*multiplot_ysize;
  82.  
  83.     eval (sprintf ("gset origin %g, %g", xo,yo));
  84.  
  85.   endif
  86.  
  87. endfunction
  88.